import 'package:enterprise_v6_app/generated/json/base/json_convert_content.dart';
import 'package:enterprise_v6_app/app/data/entities/task/process_currency_execute_entity.dart';
import 'package:enterprise_v6_app/app/data/entities/application/role_personnel_entity.dart';

import 'package:enterprise_v6_app/app/data/entities/common/form_value_entity.dart';

import 'package:enterprise_v6_app/app/data/entities/task/base_danger_investigation_info_entity.dart';


ProcessCurrencyExecuteEntity $ProcessCurrencyExecuteEntityFromJson(Map<String, dynamic> json) {
  final ProcessCurrencyExecuteEntity processCurrencyExecuteEntity = ProcessCurrencyExecuteEntity();
  final List<FormValueEntity>? formValue = (json['formValue'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<FormValueEntity>(e) as FormValueEntity).toList();
  if (formValue != null) {
    processCurrencyExecuteEntity.formValue = formValue;
  }
  final BaseDangerInvestigationInfoEntity? confirmDTO = jsonConvert.convert<BaseDangerInvestigationInfoEntity>(json['confirmDTO']);
  if (confirmDTO != null) {
    processCurrencyExecuteEntity.confirmDTO = confirmDTO;
  }
  final BaseDangerInvestigationInfoEntity? liableDTO = jsonConvert.convert<BaseDangerInvestigationInfoEntity>(json['liableDTO']);
  if (liableDTO != null) {
    processCurrencyExecuteEntity.liableDTO = liableDTO;
  }
  final BaseDangerInvestigationInfoEntity? acceptDTO = jsonConvert.convert<BaseDangerInvestigationInfoEntity>(json['acceptDTO']);
  if (acceptDTO != null) {
    processCurrencyExecuteEntity.acceptDTO = acceptDTO;
  }
  final List<RolePersonnelEntity>? nextNodeExecutor = (json['nextNodeExecutor'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<RolePersonnelEntity>(e) as RolePersonnelEntity).toList();
  if (nextNodeExecutor != null) {
    processCurrencyExecuteEntity.nextNodeExecutor = nextNodeExecutor;
  }
  final String? nodeId = jsonConvert.convert<String>(json['nodeId']);
  if (nodeId != null) {
    processCurrencyExecuteEntity.nodeId = nodeId;
  }
  final String? processEncoding = jsonConvert.convert<String>(json['processEncoding']);
  if (processEncoding != null) {
    processCurrencyExecuteEntity.processEncoding = processEncoding;
  }
  final bool? reject = jsonConvert.convert<bool>(json['reject']);
  if (reject != null) {
    processCurrencyExecuteEntity.reject = reject;
  }
  final String? rtemplateId = jsonConvert.convert<String>(json['rtemplateId']);
  if (rtemplateId != null) {
    processCurrencyExecuteEntity.rtemplateId = rtemplateId;
  }
  return processCurrencyExecuteEntity;
}

Map<String, dynamic> $ProcessCurrencyExecuteEntityToJson(ProcessCurrencyExecuteEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['formValue'] = entity.formValue?.map((v) => v.toJson()).toList();
  data['confirmDTO'] = entity.confirmDTO?.toJson();
  data['liableDTO'] = entity.liableDTO?.toJson();
  data['acceptDTO'] = entity.acceptDTO?.toJson();
  data['nextNodeExecutor'] = entity.nextNodeExecutor?.map((v) => v.toJson()).toList();
  data['nodeId'] = entity.nodeId;
  data['processEncoding'] = entity.processEncoding;
  data['reject'] = entity.reject;
  data['rtemplateId'] = entity.rtemplateId;
  return data;
}

extension ProcessCurrencyExecuteEntityExtension on ProcessCurrencyExecuteEntity {
  ProcessCurrencyExecuteEntity copyWith({
    List<FormValueEntity>? formValue,
    BaseDangerInvestigationInfoEntity? confirmDTO,
    BaseDangerInvestigationInfoEntity? liableDTO,
    BaseDangerInvestigationInfoEntity? acceptDTO,
    List<RolePersonnelEntity>? nextNodeExecutor,
    String? nodeId,
    String? processEncoding,
    bool? reject,
    String? rtemplateId,
  }) {
    return ProcessCurrencyExecuteEntity()
      ..formValue = formValue ?? this.formValue
      ..confirmDTO = confirmDTO ?? this.confirmDTO
      ..liableDTO = liableDTO ?? this.liableDTO
      ..acceptDTO = acceptDTO ?? this.acceptDTO
      ..nextNodeExecutor = nextNodeExecutor ?? this.nextNodeExecutor
      ..nodeId = nodeId ?? this.nodeId
      ..processEncoding = processEncoding ?? this.processEncoding
      ..reject = reject ?? this.reject
      ..rtemplateId = rtemplateId ?? this.rtemplateId;
  }
}
